package com.example.adms.system.controller;


import cn.dev33.satoken.annotation.SaCheckRole;
import com.example.adms.system.service.SystemService;
import com.example.adms.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hyt
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/system")
@SaCheckRole("超级管理员")// 角色检查
public class SystemController {
    @Autowired
    SystemService systemService;

    @GetMapping("/alterSystemTime")
    public Result alterSystemLeTime(int leTime, int leaveTime){
        boolean result = systemService.alterSystemTime(leTime,leaveTime);
        if (result){
            return Result.success(null);
        }
        else {
            return Result.fail(501,"修改失败");
        }
    }

    @GetMapping("/getSystemTime")
    public Result getSystemTime(){
        Map<String,Integer> map = systemService.getSystemTime();
        return Result.success(map);
    }

}
